import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/material.dart';
import 'package:kunlun_gas/app_files.dart';

import 'action.dart';
import 'state.dart';

Widget buildView(
    BlueToothSaveViewState state, Dispatch dispatch, ViewService viewService) {
  print(state.cardMemo);
  return Scaffold(
    appBar: myAppBar(viewService.context, title: '确认圈存'),
    body: Column(
      children: [
        Stack(
          children: [
            Container(
              height: 60,
              width: double.infinity,
              color: ThemeConfig.mainColor,
              margin: EdgeInsets.only(bottom: 45),
            ),
            Positioned(
              child: Container(
                height: 70,
                width: double.infinity,
                margin: EdgeInsets.symmetric(horizontal: 15),
                padding: EdgeInsets.only(left: 15),
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.all(Radius.circular(4)),
                  color: Colors.white,
                  boxShadow: [
                    BoxShadow(
                        color: ThemeConfig.rgba(9, 35, 88, 0.07),
                        offset: Offset(1.0, 1.0),
                        blurRadius: 4.0,
                        spreadRadius: 1.0),
                  ],
                ),
                child: Row(
                  children: [
                    Image.asset('images/i_icCard.png'),
                    Padding(padding: EdgeInsets.only(left: 20)),
                    Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Text(
                          state.model.name,
                          style: TextThemeConfig.Font15WithColor22,
                        ),
                        Padding(padding: EdgeInsets.only(top: 4)),
                        Row(
                          children: [
                            Text(
                              state.model.accountNo,
                              style: TextThemeConfig.Font13WithColor99,
                            ),
                            Container(
                              margin:
                                  EdgeInsets.only(left: 8, right: 8, top: 1),
                              height: 11,
                              width: 1,
                              color: Color(0xff999999),
                            ),
                            Image.asset('images/ic_blue_tooth.png'),
                            Padding(padding: EdgeInsets.only(left: 4)),
                            Text(
                              CommonUtils.checkNullToString(state.bluetoothNo),
                              style: TextThemeConfig.Font13WithColor99,
                            )
                          ],
                        )
                      ],
                    ),
                  ],
                ),
              ),
              top: 30,
              left: 0,
              right: 0,
            ),
          ],
        ),
        Container(
          margin: EdgeInsets.only(top: 40, left: 50, right: 50, bottom: 40),
          child: Text(
            '操作提示：\r\n1、选择对应设备号的蓝牙读卡器。\r\n2、将手机蓝牙设置为打开状态。\r\n3、将IC卡插入正确的读卡器后打开设备,在设备指示灯正常的情况下圈存。',
            style: TextThemeConfig.Font14WithColor99,
          ),
        ),
        Container(
          margin: EdgeInsets.only(left: 15, right: 15),
          width: double.infinity,
          height: 50,
          decoration: BoxDecoration(
            borderRadius: BorderRadius.all(Radius.circular(4)),
            color: ThemeConfig.mainColor,
          ),
          child: MyInkWellWidget(
            child: Center(
              child: Text(
                '确认圈存',
                style: TextThemeConfig.Font16WithWhite,
              ),
            ),
            onTap: () => dispatch(BlueToothSaveViewActionCreator.onSubmit()),
          ),
        ),
      ],
    ),
  );
}
